import java.lang.reflect.Array;

public class Storage
{
	public static int memorySize = 3000;
	public int[] memory;
	public Storage()
	{
		memory = new int[memorySize];
	}
	public Storage(int[] initial)
	{
		int size = Array.getLength(initial);
		memory = new int[memorySize];
		for(int i = 0; i < size; ++i)
			memory[i] = initial[i];
	}
	public int getStackPointer()
	{
		return memorySize - 1;
	}
	public int getLocation(int location)
	{
		return memory[location];
	}
	public void setLocation(int location, int val)
	{
		memory[location] = val;
	}
	public char getCharAtLocation(int location)
	{
		return IntToChar(memory[location]);
	}
	public String getString(int start)
	{
		int i = start;
		String build = "";
		while(memory[i] != 0)
			build = build + getCharAtLocation(i++);
		return build;
	}
	public char IntToChar(int character)
	{
	     
		//for whatever reason when casting these integers back into characters
		//there is an issue where they are not the character that they are supposed to be
		//not sure why it works the one way, and not the other though
		if(character == 12)
		     return '\n';
		if(character == 34)
		     return '\"';
		if(character == 39)
		     return '\'';
		if(character == 9)
		     return '\t';
		return (char)character;
	}
}